import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';

// 倒计时页面 的视频播放
class WelcomeVideoWidget extends StatefulWidget {
  @override
  _WelcomeVideoWidgetState createState() => _WelcomeVideoWidgetState();
}

class _WelcomeVideoWidgetState extends State<WelcomeVideoWidget> {
  //创建视频播放控制器
  // VideoPlayerController _controller;

  @override
  void initState() {
    super.initState();

    // _controller = VideoPlayerController.asset('assets/video/welcom.mp4')
    //   ..initialize().then((_) {
    //     _controller.play();
    //     Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
    //     setState(() {});
    //   });
  }

  @override
  Widget build(BuildContext context) {
    return Image.asset(
      "assets/images/login_bg.webp",
      //图片填充
      fit: BoxFit.fill,
    );
    // _controller.value.initialized
    //     ? SizedBox(
    //         width: MediaQuery.of(context).size.width,
    //         height: MediaQuery.of(context).size.height,
    //         child: AspectRatio(
    //           aspectRatio: _controller.value.aspectRatio,
    //           child: VideoPlayer(_controller),
    //         ),
    //       )
    //     : Container();
  }

  @override
  void dispose() {
    super.dispose();
    // _controller.dispose();
  }
}
